package com.gaofans.nrpc.common.processor;

/**
 * @author GaoFans
 */
public class SimpleEventListener<T> implements EventListener<T>{

    private final Sink<T> sink;

    public SimpleEventListener(Sink<T> sink) {
        this.sink = sink;
    }

    @Override
    public void onDataChunk(T chunk) {
        sink.next(chunk);
    }

    @Override
    public void processComplete() {
        sink.complete();
    }

    @Override
    public void processError(Throwable e) {
        sink.error(e);
    }
}
